package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class AppendAnObjectToAnArrayAndReturnTheNewArray {
	public static void main(String[] argv) {
		Object[] in = new String[]{"1", "abc", "level", null,
				"www.tah1986.com", "asdf 123"};
		Object a = "www.tah1986.com";
		System.out.println(java.util.Arrays.toString(append(in, a)));
	}

	public static Object[] append(Object[] in, Object a) {
		Object[] out = new Object[in.length + 1];
		out[in.length] = a;
		System.arraycopy(in, 0, out, 0, in.length);
		return out;
	}
}
